#!/bin/bash

while read line; do
    eval $line
done < Config/config

#  $1 = instrument name
#  $2 = month
#  $3 = year
#  $4 = e-mail address
#get list of all data files for the month-year in question
file_list=$(ls Data/$saroad-$3-[0-9][0-9]-$2)

#parse data files for single instrument	
for i in $file_list
do
	cat "$i" | grep "$1" >> $1-$2-$3
done	

bzip2 $1-$2-$3
rm -f $1-$2-$3 

command="echo \"Raw data summary for $1 during $2-$3\" | mutt -s \"Raw data summary for
$1 during $2-$3\" -a $1-$2-$3.bz2 -- $4"

eval $command

rm -f $1-$2-$3.bz2

exit


